import { JSONObject } from 'admin/schema/common';
import * as React from 'react';
import { useEffect } from 'react';
import { useSelector } from 'react-redux';
import { Link } from 'react-router-dom';

const WebLogo: React.FC = () => {
  const systemConfig = useSelector((state: JSONObject) => state.systemConfig);
  const loginInfo = useSelector((state: JSONObject) => state.loginInfo);
  useEffect(() => {
    document.title = systemConfig.systemName || '西安市综合短信发布平台';
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, []);

  return (
    <div className="logo-wrap">
      {/* <Link to="/webapp/homePage" style={{ color: '#fff' }}>
        <span>{systemConfig?.systemName || '西安市综合短信发布平台'}</span>
      </Link> */}
      <div className="logo">
        <img src="/webapp/logo192.png" />
      </div>
      <div className="user-name">{loginInfo?.nickname || loginInfo?.username || '用户名'}</div>
    </div>
  );
};

export default WebLogo;
